<?php
namespace app\common\system\validate;


use app\common\system\logic\FormLogic;
use think\Validate;

class UserValidate extends Validate
{
    protected $rule = [
        'id'    => 'require|gt:0',
        'nickname'  => 'require',
        'realname'  => 'require',
        'password'  => 'require',
        'mobile'  => 'require|mobile',
        'email'  => 'require|email',
    ];

    protected $message = [
        'id.require' => '参数错误',
        'id.gt' => '参数错误',
        'nickname.require' => '登录名不能为空',
        'realname.require' => '真实姓名不能为空',
        'password.require'  => '密码不能为空',
        'mobile.require'    => '手机号不能为空',
        'mobile.mobile'     => '手机号格式不正确',
        'email.require'     => '邮箱不能为空',
        'email.email'       => '邮箱格式不正确'
    ];

    protected $scene = [
        'create'    => ['nickname', 'realname', 'password', 'mobile', 'email'],
        'edit'  => ['id', 'nickname', 'realname', 'mobile', 'email']
    ];
}